package com.itcs.rongyun.rongsdk;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.itcs.rongyun.utils.Constants;


public class RunRongPublishSystemMessage3 implements Runnable {
	private Log LOG = LogFactory.getLog(getClass());
	
	
	public String userDeviceId;
	public String mesStr;
	private Response response;
	
	public RunRongPublishSystemMessage3(String userDeviceId,String mesStr,Response response){
		this.userDeviceId = userDeviceId;
		this.response = response;
	}
	
	public void pushThread(){
		ExecutorService exec =  Executors.newSingleThreadExecutor();
		exec.execute(this);
		exec.shutdown();
	}
	
	@Override
	public void run() {
		// 将订单信息发送给客户端
		TxtMessage txtMessage = new TxtMessage(mesStr, response);
//		LogHandlerUtil.addMainLog(LOG,groupid , "getMessageReceived3007-txtMessage-start:"+userDeviceId, txtMessage.toString());
		LOG.info("getMessageReceived3007-txtMessage-start:"+userDeviceId +","+ txtMessage.toString());
		
		SdkHttpResult shr = RongCloud.publishSystemMessage(Constants.RONGCLOUD_USERID,userDeviceId, txtMessage, "支付订单详情", "支付订单详情");
		
		LOG.info("getMessageReceived3007-txtMessage-end:"+userDeviceId +","+ shr);
//		LogHandlerUtil.addMainLog(LOG,groupid , "getMessageReceived3007-txtMessage-end:"+userDeviceId, shr.getResult()+":"+shr.getHttpCode());
//		System.out.println("============txtMessage:"+txtMessage);
		//其它推荐信息途径关闭
	}
}